package net.qanar.gwnewsfeed;

import java.util.*;

public class Item implements Comparable<Item>{
	private String title;
	private String content;
	private String source;
	private Date date;
	
	/**
	 * @param title
	 * @param content
	 * @param source
	 * @param date
	 */
	public Item(String title, String content, String source, Date date) {
		setTitle(title);
		setContent(content);
		setSource(source);
		setDate(date);
	}

	/**
	 * @return
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title
	 */
	private void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content
	 */
	private void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return
	 */
	public String getSource() {
		return source;
	}

	/**
	 * @param source
	 */
	private void setSource(String source) {
		this.source = source;
	}

	/**
	 * @return
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * @param date
	 */
	private void setDate(Date date) {
		this.date = date;
	}

	@Override
	public int compareTo(Item o) {
		return o.getDate().compareTo(getDate());
	}	
	
	@Override
	public String toString() {
		return getTitle() + "\n" + getSource() + "\n" + getDate() + "\n" + getContent();
	}
}
